<template>
  <div id="main"></div>
</template>

<script>
import Editor from "wangeditor"
export default {
  data() {
    return {
      editor: "",
    }
  },
  mounted() {
    this.editor = new Editor("#main")
    this.editor.config.focus = false

    this.editor.config.onchange = (newHtml) => {
      this.$emit("sendEditor", newHtml)
    }
    this.editor.config.onchangeTimeout = 500
    this.editor.config.menus = [
      //   "head",
      "bold",
      "fontSize",
      "fontName",
      "italic",
      "underline",
      //   "strikeThrough",
      "indent",
      "lineHeight",
      "foreColor",
      //   "backColor",
      "link",
      "list",
      //   "todo",
      "justify",
      "quote",
      "emoticon",
      "image",
      //   "video",
      "table",
      //   "code",
      //   "splitLine",
      "undo",
      "redo",
    ]
    this.editor.create()
  },
}
</script>

<style></style>
